/*=============================================================================
#    The element-comm is a tentative program used to test our ideas.           
#                       Copyright (C)  bgao                                    
#
#     This program is free software; you can redistribute it and/or            
#      modify it under the terms of the GNU General Public License             
#     as published by the Free Software Foundation; either version 2           
#         of the License, or (at your option) any later version.               
#
#     This program is distributed in the hope that it will be useful,          
#    but WITHOUT ANY WARRANTY; without even the implied warranty of           
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            
#             GNU General Public License for more details.                    
#
#    You should have received a copy of the GNU General Public License        
#     along with this program; if not, write to the Free Software             
#      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,             
#                       MA  02110-1301, USA.                                  
#==============================================================================
# $Id: mac_phy.c 348 2010-11-29 09:01:16Z bgao $ 
#
# $Author: bgao $ 
#
# $Revision: 348 $ 
#
# $Date: 2010-11-29 17:01:16 +0800 (星期一, 29 十一月 2010) $ 
#
# Description: 
#
=============================================================================*/
/*! @file mac_phy.c
 *  @brief This file implements the functions used to set/get the
 *         constant value of PHY.
 */
#include "mac_phy.h"

/*! the static instance of physical information */
static phy_pib_t phy_pib;

/*! initialize the pib.
 *  @return return the status of this operation.
 */
int8 phy_init(void)
{
    phy_pib.phy_shr_duration = 10;
    phy_pib.phy_symbol_per_octet = 2;
    phy_pib.phy_max_frm_duration = 266;

    return MAC_OK;
}

/*! get the SHR duration, which is the duration of the
 *  synchronization header(SHR) in symbols for the current PHY.
 *  @return the value of SHR.
 */
uint8 phy_get_shr_duration(void)
{
    return phy_pib.phy_shr_duration;
}

/*! set the SHR duration.
 *  @return return the SHR duration value
 */
uint8 phy_set_shr_duration(uint8 s)
{
    phy_pib.phy_shr_duration = s;

    return phy_pib.phy_shr_duration;
}

/*! get the number of symbols used to transmit each octet.
 *  @return return the number of symbols used to transmitted each octet.
 */
uint8 phy_get_symbol_per_octet(void)
{
    return phy_pib.phy_symbol_per_octet;
}

/*! set the number of symbols used to transmit each octet.
 *  @param s the number of symbols to set.
 *  @return the number of symbols to transmit each octec.
 */
uint8 phy_set_symbol_per_octet(uint8 s)
{
    phy_pib.phy_symbol_per_octet = s;
    return phy_pib.phy_symbol_per_octet;
}
